#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：测试.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-12 14:23
'''
from typing import Optional


class Solution(object):
    def twoSum(self, nums:list[int], target:int) -> list[int]:
        """
        :type nums: List[int]
        :type target: int
        :rtype: List[int]
        """
        hashtable = dict()
        for i, num in enumerate(nums):
            if target - num in hashtable:
                return [hashtable[target - num], i]
            hashtable[num] = i

        return []

solution = Solution()
res = solution.twoSum([-1,-2,-3,-7,-3], -8)
print(res)